package com.mashiguang.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.mashiguang.po.Resource;

public class ResourceDaoImpl extends HibernateDaoSupport implements ResourceDao {

	public Resource getResourceByUrl(String url) {
		String hql = "from Resource" +
				" where resourceUrl = ?";
		List<Resource> resources = getHibernateTemplate().find(hql, url);
		return resources.get(0);
	}
	
	public List<Resource> getAll() {
		String hql = "from Resource";
		List<Resource> resources = getHibernateTemplate().find(hql);
		return resources;
	}

}
